package cn.tedu.lianxi1;

import com.sun.org.apache.bcel.internal.generic.BREAKPOINT;

import java.text.BreakIterator;

public class Text2 {
    public static void main(String[] args) {
        Maipiao1 a=new Maipiao1();
        Thread t1=new Thread(a,"窗口1");
        Thread t2=new Thread(a,"窗口2");
        Thread t3=new Thread(a,"窗口3");
        Thread t4=new Thread(a,"窗口4");
        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }
}
class Maipiao1 implements Runnable{
    int i = 100;
    @Override
    public void run() {
        while (true) {
            synchronized (this) {
                if (i > 0) {
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(Thread.currentThread().getName() + "===" + i--);
                }else
                    break;


            }
        }

    }

}
